package com.d0318;
public class ThreadSleepOne implements Runnable {
    String name;
    @Override
    public void run() {
        for (int i = 0; i <10 ; i++) {
            try {
                Thread.sleep(100);//使进程进入阻塞状态
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(name+":"+i);
        }
    }

    public static void main(String[] args) {
        ThreadSleepOne one=new ThreadSleepOne();
        ThreadSleepOne two=new ThreadSleepOne();
        Thread t1=new Thread(one);
        Thread t2=new Thread(two);
        t1.setPriority(Thread.MAX_PRIORITY);
        t2.setPriority(Thread.MIN_PRIORITY);
        one.name="one";
        two.name="two";
        System.out.println(t1);//打印第一个线程
        System.out.println(t2);//打印第二个线程
        t1.start();//启动第一个线程
        t2.start();//启动第二个线程
    }

}